import { defineConfig } from "vite"
import { Api_Dev, Proxy_Prefix } from "./config"
import uni from "@dcloudio/vite-plugin-uni"

export default defineConfig({
  build: {
    sourcemap: true,
  },
  plugins: [
    uni(),
  ],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import "~@/style/modules/_variable.scss";`,
      },
    },
  },
  server: {
    proxy: {
      [Proxy_Prefix]: {
        target: Api_Dev,
        changeOrigin: true,
        rewrite: path => path.replace(new RegExp(`^${Proxy_Prefix}`), '')
      },
    },
    hmr: true
  }
})
